home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2009 February / PCWFEB09.iso / Software / Linux / Kubuntu 8.10 / kubuntu-8.10-desktop-i386.iso / casper / filesystem.squashfs / usr / share / snmp / mib2c-data / syntax-RowStatus-dependencies.m2i < prev    next >
Text File  |  2008-09-22  |  4KB  |  114 lines

  1. #############################################################  -*- c -*-
  2. ## generic include for XXX. Do not use directly.
  3. ##
  4. ## $Id: syntax-RowStatus-dependencies.m2i 12850 2005-09-27 15:42:43Z rstory $
  5. ########################################################################
  6. @if $m2c_mark_boundary == 1@
  7. /** START code generated by $RCSfile$ $Revision: 12850 $ */
  8. @end@
  9. ########################################################################
  10. ## {
  11.     /*
  12.      * check RowStatus dependencies
  13.      */
  14.     if (rowreq_ctx->column_set_flags & COLUMN_$node.uc_FLAG) {
  15.         /*
  16.          * check for valid RowStatus transition (old, new)
  17.          * (Note: move transition check to $node_check_value
  18.          *  to catch errors earlier)
  19.          */
  20.         rc = check_rowstatus_transition( ${m2c_undo_item}$node,
  21.                                          ${m2c_data_item}$node );
  22.         if (MFD_SUCCESS != rc)
  23.             return rc;
  24.         
  25. @if $m2c_table_row_creation == 1@
  26.         /*
  27.          * row creation requirements
  28.          */
  29.         if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
  30.             if (ROWSTATUS_DESTROY ==  ${m2c_data_item}$node) {
  31.                 rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
  32.             }
  33.             else if (ROWSTATUS_CREATEANDGO ==  ${m2c_data_item}$node) {
  34.                 if ((rowreq_ctx->column_set_flags & $context.uc_REQUIRED_COLS)
  35.                     != $context.uc_REQUIRED_COLS) {
  36.                     DEBUGMSGTL(("${context}",
  37.                                 "required columns missing (0x%0x != 0x%0x)\n",
  38.                                 rowreq_ctx->column_set_flags, $context.uc_REQUIRED_COLS));
  39.                     return MFD_CANNOT_CREATE_NOW;
  40.                 }
  41.                 ${m2c_data_item}$node = ROWSTATUS_ACTIVE;
  42.             }
  43.         } /* row creation */
  44.         else {
  45. @end@
  46.             /*
  47.              * row change requirements
  48.              */
  49.             /*
  50.              * don't allow a destroy if any other value was changed, since
  51.              * that might call data access routines with bad info.
  52.              *
  53.              * you may or may not require the row be notInService before it
  54.              * can be destroyed.
  55.              */
  56.             if (ROWSTATUS_DESTROY == ${m2c_data_item}$node) {
  57. @if $m2c_table_refcounts == 1@
  58.                 if (0 != rowreq_ctx->ref_count) {
  59.                     DEBUGMSGTL(("$context",
  60.                                 "can't delete row, %d references\n",
  61.                                 rowreq_ctx->ref_count));
  62.                     return MFD_NOT_VALID_NOW;
  63.                 }
  64. @end@
  65.                 if (rowreq_ctx->column_set_flags & ~COLUMN_$node.uc_FLAG) {
  66.                     DEBUGMSGTL(("$context",
  67.                                 "destroy must be only varbind for row\n"));
  68.                     return MFD_NOT_VALID_NOW;
  69.                 }
  70.                 rowreq_ctx->rowreq_flags |= MFD_ROW_DELETED;
  71.  
  72.             } /* row destroy */
  73. @if $m2c_table_refcounts == 1@
  74.             else if(ROWSTATUS_NOTINSERVICE == ${m2c_data_item}$node) {
  75.                 if (0 != rowreq_ctx->ref_count) {
  76.                     DEBUGMSGTL(("$context",
  77.                                 "can't deactivate row, %d references\n",
  78.                                 rowreq_ctx->ref_count));
  79.                     return MFD_NOT_VALID_NOW;
  80.                 }
  81.             } /* notInService */
  82. @end@
  83. @if $m2c_table_row_creation == 1@
  84.         } /* row change */
  85. @end@
  86.     }
  87.     else {
  88. @if $m2c_table_row_creation == 1@
  89.         /*
  90.          * must have row status to create a row
  91.          */
  92.         if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
  93.             DEBUGMSGTL(("$context",
  94.                         "must use RowStatus to create rows\n"));
  95.             return MFD_CANNOT_CREATE_NOW;
  96.         }
  97. @else@
  98.         /*
  99.          * row creation not supported
  100.          */
  101.         if (rowreq_ctx->rowreq_flags & MFD_ROW_CREATED) {
  102.             DEBUGMSGTL(("$context",
  103.                         "row creation not supported\n"));
  104.             return MFD_CANNOT_CREATE_EVER;
  105.         }
  106. @end@
  107.     } /* row status not set */
  108.  
  109. ## }
  110. ########################################################################
  111. @if $m2c_mark_boundary == 1@
  112. /** END code generated by $RCSfile$ $Revision: 12850 $ */
  113. @end@
  114.